﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Cafe.Models
{
    public class CafePlace
    {
        private static int nextID = 0;
        private int id;

        public int ID
        {
            get { return id; }
        }
        public string Name { get; set; }
        public string Location { get; set; }
        public string Category { get; set; }

        public float Average { get; set; }
        public void SetAvg(List<Review> reviews)
        {
            int total = 0;
            foreach (var review in reviews)
            {
                total += (int)review.Rating + 1;
             
            }
            Average = (float)total / (float)reviews.Count();

        }

        public CafePlace(string name, string location, string category)
        {
            Name = name;
            Location = location;
            Category = category;
            id = nextID++;
        }




    }
}